package acwing.模拟;

import java.util.Scanner;

/**
 * 日期问题
 *
 * @author yang
 * @date 2021/11/26
 */
public class 日期问题 {

    static int[] days = {0,31,28,31,30,31,30,31,31,30,31,30,31};

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split("/");
        int a = Integer.parseInt(s[0]), b = Integer.parseInt(s[1]), c = Integer.parseInt(s[2]);

        for (int i = 19600101 ; i<= 20591231 ; i++) {

            int year = i / 10000, month = i % 10000 / 100, day = i % 100;
            if (check(year, month, day)) {
                if (year % 100 == a && month == b && day == c ||
                    year % 100 == c && month == a && day == b ||
                    year % 100 == c && month == b && day == a) {
                    // %02d 不足两位补0
                    System.out.printf("%d-%02d-%02d", year, month, day);
                    System.out.println();
                }

            }
        }
    }

    private static boolean check(int year, int month, int day) {
        if (month == 0 || month > 12) return false;
        if (day <= 0 || month != 2 && day > days[month]) return false;
        // 单独判断闰年的情况
        if (month == 2) {
            int leap = 0;
            if (year % 100 != 0 && year % 4 == 0 || year % 400 == 0) leap = 1;
            if (day > 28 + leap) return false;
        }
        return true;
    }
}
